<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
  /*
  * 前置知识
  * */
  // Number() 函数会把独享的值转为数字，如果无法转换，则返回NaN
  console.log( Number('123') ) // 123
  console.log( Number('1.25') ) // 1.25
  console.log( Number('-15') ) // -15
  console.log( Number(null) ) // 0
  console.log( Number('wret') ) // NaN
  console.log( Number(undefined) ) // NaN
  console.log( Number('15ww') ) // NaN
  console.log( Number('qq15') ) // NaN
  console.log(NaN == NaN) // false
  console.log(null === null) // true

  function toNum(arr){
      let res = []
      arr.forEach( item => {
          if(Number(item).toString() != 'NaN' && item != null){
              res.push(item)
          }
      })
      return res
  }

  console.log( toNum(["567",null,"u44","0",1,"eleven","ten","99"]) )
  // ['567', '0', 1, '99']

</script>

</body>
</html>
